//
//  TTAPI+Work.swift
//  TTBLL
//
//  Created by Toj on 4/16/21.
//

import Foundation

extension TTAPIRequest.API {
    
    /// 作品 - 列表
    static var works: TTAPIRequest.API {
        return TTAPIRequest.API(rawValue: "/pad/course/works/pageQueryStudentWork")
    }
    
    ///
    static var creation: TTAPIRequest.API {
        return TTAPIRequest.API(rawValue: "/user/c/v1.0/pageUserWorks")
    }
    
    ///
    static var workDelete: TTAPIRequest.API {
        return TTAPIRequest.API(rawValue: "/user/c/v1.0/workDelete")
    }
    
    /// 作业 - 视频上传
    static var queryAliVideoInfo: TTAPIRequest.API {
        return TTAPIRequest.API(rawValue: "/broadcast/c/v1.0/queryAliVideoInfo")
    }
    
    /// 作业 - 上传
    static var saveHomework: TTAPIRequest.API {
        return TTAPIRequest.API(rawValue: "/course/c/v1.0/saveUserHomework")
    }
}

extension TTAPI.Request {
    
    static func works(_ parameters:[String: Any]? = nil,
               completion:((_ response:TTResponse<TTWork>)->())?) {
        
        general(api: .works, model: TTWork.self, parameters: parameters, completion: completion)
    }
}
